// 以下是为上述表结构提供的MySQL增删改查（CRUD）语句示例：

// 插入数据（Create）
/***********************************************************插入数据（Create）*********************************************************************/

// 播放内容表
const sqlAddBroadcast = `
INSERT INTO broadcast (Title, Description, BroadcastLink, StartTime, EndTime, CategoryID, VideoSourceID, NewsID)  
VALUES (?, ?, ?, NOW(), NOW() + INTERVAL 1 HOUR, ?, ?, ?);`

// 访问来源表
const sqlAddAccessSource = `
INSERT INTO accesssource (SourceName, SourceLink)  
VALUES (?, ?);`

// 类别表
const sqlAddCategory = `
INSERT INTO category (CategoryName, Description)  
VALUES (?, ?);`

// 视频来源表
const sqlAddVideoSource = `
INSERT INTO videosource (SourceName, SourceLink)  
VALUES (?, ?);`

// 用户信息表
const sqlAddUserInfo = `
INSERT INTO userinfo (UserName, Password, Email)  
VALUES (?, ?, ?);`

// 新闻表
const sqlAddNews = `
INSERT INTO news (Title, , PublishTime, SourceID)  
VALUES (?, ?, NOW(), ?);`

module.exports = {
  sqlAddBroadcast,
  sqlAddAccessSource,
  sqlAddCategory,
  sqlAddVideoSource,
  sqlAddUserInfo,
  sqlAddNews
}
/**************************************************************查询数据（Read）******************************************************************/

// 查询数据（Read）

// 播放内容表
const sqlBroadcast = `
SELECT * FROM broadcast;`

// 访问来源表
const sqlAccessSource = `
SELECT * FROM accesssource;`

// 类别表
const sqlCategory = `
SELECT * FROM category;`

// 视频来源表
const sqlVideoSource = `
SELECT * FROM videosource;`

// 用户信息表
const sqlUserInfo = `
SELECT * FROM userinfo;`

// 新闻表
const sqlNews = `
SELECT * FROM news;`

module.exports = {
  sqlBroadcast,
  sqlAccessSource,
  sqlCategory,
  sqlVideoSource,
  sqlUserInfo,
  sqlNews
}
/**************************************************************更新数据（Update）******************************************************************/

// 更新数据（Update）
// 播放内容表

const updatedBroadcast = `
UPDATE broadcast  
SET Title = ?
WHERE BroadcastID = ?;`

// 访问来源表
const updatedAccessSource = `
UPDATE accesssource  
SET SourceName = ?
WHERE AccessSourceID = ?;`
// 类别表
const updatedCategory = `
UPDATE category  
SET CategoryName = ? 
WHERE CategoryID = ?;`

// 视频来源表
const updatedVideoSource = `
UPDATE videosource  
SET SourceLink = ? 
WHERE VideoSourceID = ?;`

// 用户信息表
const updatedUserInfo = `
UPDATE userinfo  
SET Email = ?  
WHERE UserID = ?;`

// 新闻表
const updatedNews = `
UPDATE news  
SET Content = ?
WHERE NewsID = ?;`

module.exports = {
  updatedBroadcast,
  updatedAccessSource,
  updatedCategory,
  updatedVideoSource,
  updatedUserInfo,
  updatedNews
}

/**************************************************************删除数据（Delete）******************************************************************/

// 删除数据（Delete）
// 播放内容表

const deleteBroadcast = `
DELETE FROM broadcast WHERE BroadcastID = ?;`

// 访问来源表
const deleteAccessSource = `
DELETE FROM accesssource WHERE AccessSourceID = ?;`

// 类别表
const deleteCategory = `
DELETE FROM category WHERE CategoryID = ?;`

// 视频来源表
const deleteVideoSource = `
DELETE FROM videosource WHERE VideoSourceID = ?;`

// 用户信息表
const deleteUserInfo = `
DELETE FROM userinfo WHERE UserID = ?;`

// 新闻表
const deleteNews = `
DELETE FROM news WHERE NewsID = ?;`



module.exports = {
  deleteBroadcast,
  deleteAccessSource,
  deleteCategory,
  deleteVideoSource,
  deleteUserInfo,
  deleteNews
}